<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>

<html>
	<head>
		<title>系统列表</title>
		<%@ include file="/common/meta.jsp"%>
		<%@ include file="/common/jquery-ui-inc.jsp"%>
		<script>

$(function() {
	$('#sysList').datagrid( {
		title : '系统列表',
		url : '${ctx}/flow/system/flow-sys!data.action',
		loadMsg : '数据载入中，请稍后……',
		nowrap : false,
		//striped: true,
		collapsible : false,
		fitColumns : true,
		pagination : true,
		singleSelect : true,
		rownumbers : true,
		remoteSort : false,
		pageList : [ 15, 30, 50 ],
		idField : 'sysId',
		frozenColumns : [ [ {
			title : '中文名称',
			field : 'sysCname',
			width : 200,
			formatter : function(value) {
				return '<span style="color:blue">' + value + '</span>';
			}
		} ] ],
		columns : [ [ {
			field : 'sysEname',
			title : '英文标识',
			width : 100,
			sorter : function(a, b) {
				return (a > b ? 1 : -1);
			}
		}, {
			field : 'createTime',
			title : '创建时间',
			width : 100,
			sorter : function(a, b) {
				return (a > b ? 1 : -1);
			}
		}, {
			field : 'createUser',
			title : '创建人',
			width : 100
		}] ],

		toolbar : [  {
			text : '资源管理',
			iconCls : 'icon-edit',
			handler : function() {
				editLock();
			}
		}, '-',

		{
			text : '刷新',
			iconCls : 'icon-reload',
			handler : function() {
				reload('');
			}
		} ],
		onDblClickRow:function(row){
			editLock();
		}
	});
});



function editLock() {
	var node = getSelected();
	if (node) {
		var editLockUrl = '${ctx}/flow/task_url/flow-task-url!toData.action?sysId='+node.sysId;
		window.location.href=editLockUrl;
	}
}


function closeAddWin(){
	$('#sysAddWin').window('close');
}



function getSelected() {
	var selected = $('#sysList').datagrid('getSelected');
	if (selected) {
		return selected;
	} else {
		$.messager.alert('提示', '请选择要操作的系统', 'info');
	}
}

function reload(){
	$('#sysList').datagrid('reload');
}
		
function lockQuery(){					
    var queryParams = $('#sysList').datagrid('options').queryParams;
    var opt = $('#sysList').datagrid('options'); 
     $('#sysList').datagrid('options').pageNumber=1;
      queryParams.sysCname = $('#sysCname').val();
      queryParams.sysEname = $('#sysEname').val();
      reload(); 
       var page = $('#sysList').datagrid('getPager');
	page.pagination({pageNumber:1,pageSize:opt.pageSize});
  }
function clearQuery(){					
    $('#sysCname').val('');
    $('#sysEname').val('');
    lockQuery(); 
  }
	  
			
	</script>
	</head>

	<body>
		<table class="datagrid-body">
			<tr>
				<td class="datagrid-header">
					中文名称
				</td>
				<td>
					<input name="sysCname" id="sysCname" value=""/>
				</td>
				<td class="datagrid-header">
					英文标识
				</td>
				<td>
					<input name="sysEname" id="sysEname" value=""/>
				</td>
				<td>
					<a class="easyui-linkbutton" iconCls="icon-search"
						onclick="lockQuery();">查询</a>
					<a class="easyui-linkbutton" iconCls="" onclick="clearQuery();">清空</a>
				</td>
			</tr>
		</table>


		<table id="sysList"></table>


	</body>
</html>